<?php
namespace repertory\service;

/**--tmpl-use--**/
use herosphp\core\Loader;

/**--tmpl-import--**/
class RepertoryService extends CommonService
{

    /**
     * 性质:1=自营,2=第三方
     * @param $k
     * @return mixed
     */

    public function getTypeText($k = '__all')
    {
        $arr = array('1' => '自营', '2' => '第三方');
        return $k == '__all' ? $arr : $arr[$k];
    }

    public function getRepertorys()
    {

        $items = Loader::model('repertory')->getItems(array('is_delete'=>'0'));
        $result = array();
        foreach ($items as $k => $v) {
            $result[$v['id']] = $v['name'];
        }
        return $result;
    }

    /**
     * 根据省、市、区获取拼接详细地址
     * @param $addressJson
     */
    /*
    public function getAddressText($addressJson){

        $addressArr=json_decode($addressJson,true);

        return $addressArr['prov'].''.$addressArr['city'].''.$addressArr['county'];

    }*/

}

